<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
?>

<div class="notice-form">

    <?php
    $form = ActiveForm::begin([
                'id'                     => 'Notice',
                'layout'                 => 'horizontal',
                'enableClientValidation' => true,
                'errorSummaryCssClass'   => 'error-summary alert alert-error'
                    ]
    );
    ?>

    <div class="">
        <?php echo $form->errorSummary($model); ?>

        <?= $form->field($model, 'user_id')->widget('yiike\user\widgets\UserPicker', [
            
        ]) ?>
        <?= $form->field($model, 'level')->dropDownList($model->levelOptions)?>

        <div class="form-group field-notice-title required ">
            <label class="control-label col-sm-3" for="notice-title">标题</label>
            <div class="col-sm-6">
                <div class="input-group"> 
                    <span class="input-group-btn">
                        <?php
                        echo \insolita\iconpicker\Iconpicker::widget([
                            'id'            => 'title_icon',
                            'name'          => Html::getInputName($model, 'title_icon'),
                            'value'         => $model->title_icon ? : 'fa-dot-circle-o',
                            'iconset'       => 'fontawesome',
                            'pickerOptions' => ['class' => 'btn btn-flat btn-default', 'style' => 'background:#fff;'],
                            'clientOptions' => [ 'rows' => 8, 'cols' => 10, 'placement' => 'right'],
                        ]);
                        ?>
                    </span>
                    <?=  Html::activeTextInput($model, 'title', ['class' => 'form-control']) ?>
                </div>

                <div class="help-block help-block-error "></div>
            </div>
            <div class="help-block col-sm-3"></div>
        </div>
        
        <?= $form->field($model, 'content')->textarea(['rows' => 6]) ?>

        <?php $model->status = $model->status === null ? 1 : $model->status; ?>
        <?= $form->field($model, 'status')->widget('kartik\widgets\SwitchInput', 
                [
                    'containerOptions' => ['class' => ''], 
                    'pluginOptions' => ['onText'=> '开', 'offText'=> '关'],
                ]);
        ?>
         
        <hr/>

        <div class="form-group">
            <div class="col-sm-6 col-lg-offset-3">
                <?= Html::submitButton('<span class="fa fa-check-square-o"></span> 保存', ['id' => 'save-' . $model->formName(), 'class' => 'btn btn-success']); ?>
            </div>
        </div>
        <br />
        <?php ActiveForm::end(); ?>

    </div>

</div>

